<template>
	<view class="ljapp">
		<image class="qrcode" :src="$base.img(qrcode)" mode="aspectFill"></image>
		<view class="title">邀请机构入驻赚佣金</view>
		<view class="btn" @click="copyCode(code)">邀请码：{{code}}</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				code: '',
				qrcode: '',
			}
		},
		onLoad() {
			this.$Http({
				url: 'getInviteCode',
				data: {},
				type:'POST',
			}).then(res => {
				if (res.code == 1) {
					this.code = res.data.code
					this.qrcode = res.data.qrcode
				}else{
					this.code = res.data.code
					this.$u.toast(res.msg)
				}
			});
		},
		methods: {
			copyCode(value) {
				uni.setClipboardData({
					data: value.toString(),
					success: () => {
						uni.showToast({
							title: "复制成功"
						})
					},
					fail: (e) => {
						console.log(e)
					}
				})
			},
		}
	}
</script>

<style lang="less">
	@import '@/pagesB/style.less';

	page{background:#fff;}

	.qrcode{
		display: block;
		width: 260rpx;
		height: 260rpx;
		margin: 260rpx auto 0;
	}
	.title{
		font-size: 36rpx;
		color: #3594ff;
		text-align: center;
		margin-top: 16rpx;
	}
	.btn{
		width: 350rpx;
		height: 100rpx;
		line-height: 100rpx;
		border-radius: 10rpx;
		font-size: 43rpx;
		font-weight: 500;
		background-color: #3593ff;
		margin-top: 40rpx;
	}
</style>
